package com.zy.openchat.util.glide;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.bumptech.glide.load.Options;
import com.bumptech.glide.load.model.ModelLoader;
import com.bumptech.glide.load.model.ModelLoaderFactory;
import com.bumptech.glide.load.model.MultiModelLoaderFactory;
import com.zy.openchat.core.model.photo.PhotoInfo;

import java.io.InputStream;

public class PhotoInfoGlideLoader implements ModelLoader<PhotoInfo, InputStream> {

    @Nullable
    @Override
    public LoadData<InputStream> buildLoadData(@NonNull PhotoInfo photoInfo, int width, int height, @NonNull Options options) {
        return null;
    }

    @Override
    public boolean handles(@NonNull PhotoInfo photoInfo) {
        return true;
    }

    public static class StreamFactory implements ModelLoaderFactory<PhotoInfo, InputStream> {

        @NonNull
        @Override
        public ModelLoader<PhotoInfo, InputStream> build(@NonNull MultiModelLoaderFactory multiFactory) {
            return new PhotoInfoGlideLoader();
        }

        @Override
        public void teardown() {
            // Do nothing.
        }
    }
}
